package com.px.lovepath.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

	private static SimpleDateFormat sSdf = null;
	private static SimpleDateFormat sCompleteSdf = null;
	
	static {
		sSdf = new SimpleDateFormat("yyyy/MM/dd");
		sCompleteSdf = new SimpleDateFormat("yyyy/MM/dd hh点mm分ss秒");
	};
	
	public static final String getDateString(Date date) {
		return sSdf.format(date);
	}
	
	// TODO 待改进
	public static final String getColloquialDateString(Date date) {
		return getDateString(date);
	}
	
	public static final String getCompleteDateString(Date date) {
		return sCompleteSdf.format(date);
	}
	
	public static final String getPrefixTimeString(Date date) {
		StringBuffer sb = new StringBuffer();
		int hour = date.getHours();
		if (0 <= hour && hour < 6) {
			sb.append("凌晨");
		} else if (6 <= hour && hour < 10) {
			sb.append("早上");
		} else if (10 <= hour && hour < 14) {
			sb.append("中午");
		} else if (14 <= hour && hour < 18) {
			sb.append("下午");
		} else {
			sb.append("晚上");
		}
		return sb.toString();
	}
}
